import type { InjectionKey, Ref } from "vue";

// 定义组件接收的props：Name类型
export type CollapseActiveName = string | number

// CollapseItem组件接收的props: name标识/title标题/disabled是否禁用
// title和disabled是非必选值
export interface CollapseItemProps {
  name: CollapseActiveName;
  title?: string;
  disabled?: boolean;
}

// 接收Inject类型
export interface CollapseContext {
  // 当前处于激活状态（展开状态）的折叠项
  activeNames: Ref<CollapseActiveName[]>,
  // 处理折叠项被点击时的逻辑
  handleItemClick: (name: CollapseActiveName) => void
}
// 折叠面板组件的上下文信息
export const collapseContextKey: InjectionKey<CollapseContext> = Symbol('collapseContextKey')

export interface CollapseProps{
  modelValue: CollapseActiveName[];
  accordion?: boolean;
}

export interface CollapseEmits{
  (e: 'update:modelValue', Value:CollapseActiveName[]): void,
  (e:'change',values:CollapseActiveName[]):void
}